package thirtysix

import scala.util.Random

/**
  * @author gouyangyang on 2019/3/19/019 11:00
  */
object Caquangame {

  def main(args: Array[String]): Unit = {
    val arr=Array("拳头","剪刀","布")
    val diannao=arr(Random.nextInt(arr.length))
    val ren=arr(Random.nextInt(arr.length))

    if (diannao.equals("拳头")){
      if(ren.equals("布")){
        println("电脑:"+diannao+"," +"我:"+ren+"，您赢了^_^")
      }
      if(ren.equals("剪刀")) {
        println("电脑:" + diannao +"," +"我:"+ren+ "，您输了^_^")
      }
      if(ren.equals("拳头")) {
        println("电脑:" + diannao +"," + "我:"+ren+"，平局^_^")
      }
    }
    if (diannao.equals("剪刀")){
      if(ren.equals("布")){
        println("电脑:"+diannao+"," +"我:"+ren+"，您输了^_^")
      }
      if(ren.equals("拳头")) {
        println("电脑:" + diannao + "," +"我:"+ren+"，您赢了^_^^_^")
      }
      if(ren.equals("剪刀")) {
        println("电脑:" + diannao+"," + "我:"+ren+"，平局^_^")
      }

    }
    if (diannao.equals("布")){
      if(ren.equals("布")){
        println("电脑:" + diannao +","+"我:"+ren+"平局^_^")
      }
      if(ren.equals("剪刀")) {
        println("电脑:" + diannao+","+"我:"+ren+ "，您赢了^_^")
      }
      if(ren.equals("拳头")) {
        println("电脑:" + diannao +","+"我:"+ren+ "，您输了^_^^_^")
      }
    }

  }
}
